//文章类API
import request from "utils/request";

//查询文章列表
export const getArticleListAPI = (params) => {
  return request({
    url: "/v1_0/mp/articles",
    params,
  });
};
//删除文章
export const delArticleListAPI = (id) => {
  return request({
    url: "/v1_0/mp/articles/" + id,
    method: "delete",
  });
};
// 1. 改造发布的接口，支持传参draft表示存为草稿
export const publishArticleAPI = (data, draft = false) => {
  return request({
    url: `/v1_0/mp/articles?draft=${draft}`,
    method: "POST",
    data,
  });
};
//获取文章详情
export const getArticleByIdAPI = (id) => {
  return request({
    url: "/v1_0/mp/articles/" + id,
  });
};
//编辑文章
export const editLishArticleAPI = (data, draft = false, id) => {
  return request({
    url: `/v1_0/mp/articles/${id}?draft=${draft}`,
    method: "put",
    data,
  });
};
